﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Net;

namespace Hop.Hop.Web
{
    public partial class _Default : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            Common.WhoAmI.TraceWhoIAm("WebSite");            
            lblUser.Text = Page.User.Identity.Name;
        }

        protected void btnHop(object sender, EventArgs e)
        {
            try
            {
                var service = new Service.Service();

                // BAD service.Credentials = new NetworkCredential("Fred", "Password");
                service.Credentials = CredentialCache.DefaultCredentials;
                
                this.lblFeedBack.Text = service.PlaceOrder();
            }
            catch (Exception ex)
            {
                
                this.lblFeedBack.Text = Server.HtmlEncode(ex.Message);
            }
        }
    }
}
